<?php
require_once('../../auth/auth.php');

   $id = $_REQUEST['user_id'] ;
   $firstname=$_POST['first_name'];    
 	$lastname=$_POST['last_name']; 
 	$created = $_POST['created_on'];   
	$userType=$_POST['userType'];    
	$activeStatus=$_POST['activeStatus']; 
		
		
// Switch usertype  to integers

if ($userType == "Administrator"){
	$userType = 0;
} elseif($userType == "Volunteer") {
	$userType = 1;
} elseif($userType == "Adoptive Family") {
	$userType = 2;
}

// Switch Active status to integers
if ($activeStatus == "Active"){
	$activeStatus = 1;
} elseif($activeStatus == "Pending") {
	$activeStatus = 0;
} elseif($activeStatus == "Banned") {
	$activeStatus = -1;
}

echo $userType;
echo $activeStatus;
	
include 'db_Connect.php';

$account = "UPDATE User SET first_name='".$firstname."', last_name='".$lastname."', created='".$created."', user_type='".$userType."', active_status='".$activeStatus."' WHERE user_id = $id";
echo $account;
$result = mysql_query($account);

if($result){
	echo("<br> Account successfully updated");

} else{
	echo("<br> Account update failed");
}

include 'db_Close.php';

?>